package com.ukao.steward.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.ukao.steward.util.CheckUtils;

import java.util.List;

/**
 * Created by ukaodev on 2017/10/27.
 */

public class ShoppingBean extends BaseListBean<ShoppingBean> implements Parcelable {


    /**
     * isCustomNum : 0
     * code : 432
     * saleType : 2
     * businessId : 1
     * discount : 2
     * cityId : 1
     * storeId : 0
     * sortNo : 1
     * unit : 1
     * firstWord : XK
     * price : 1500
     * imgPath : null
     * name : 西裤
     * typeId : 42
     * id : 31
     * unitText : 元
     */

    private int isCustomNum;
    private String code;

    private int saleType = 0;
    private List<ServiceListBean> serviceList;
    private int discount;
    private int cityId;
    private int storeId;
    private int sortNo;
    private int unit;
    private String firstWord;
    private int price;
    private int saleDiscount;

    private String imgPath;
    private String name;
    private String typeId;
    private String id;
    private String unitText;
    private int count;
    private String businessName;
    private String businessId;
    private String mercBusinessId;
    private String selectServiceName = "";
    private String selectServiceId = "";
    private String proTypeId;

    public String getSelectServiceId() {
        return CheckUtils.isEmptyString(selectServiceId);
    }

    public ShoppingBean(String id, int cnt, String name, String path, int price, int discount, String selectServiceName, String selectServiceId) {
        this.id = id;
        this.count = cnt;
        this.name = name;
        this.imgPath = path;
        this.price = price;
        this.saleDiscount = discount;
        this.selectServiceName = selectServiceName;
        this.selectServiceId = selectServiceId;


    }

    public ShoppingBean(String mercBusinessId, String proTypeId, String businessId, String businessName, String id, int cnt, String name, String path, int price, int discount, String selectServiceName, String selectServiceId) {
        this.mercBusinessId = mercBusinessId;
        this.typeId = proTypeId;
        this.businessId = businessId;
        this.businessName = businessName;
        this.id = id;
        this.count = cnt;
        this.name = name;
        this.imgPath = path;
        this.price = price;
        this.saleDiscount = discount;
        this.selectServiceName = selectServiceName;
        this.selectServiceId = selectServiceId;


    }



    public void setSelectServiceId(String selectServiceId) {
        this.selectServiceId = selectServiceId;
    }

    public String getSelectServiceName() {
        return CheckUtils.isEmptyString(selectServiceName);
    }

    public void setSelectServiceName(String selectServiceName) {
        this.selectServiceName = selectServiceName;
    }


    public void setMercBusinessId(String mercBusinessId) {
        this.mercBusinessId = mercBusinessId;
    }

    public String getBusinessName() {
        return businessName;
    }

    public void setBusinessName(String businessName) {
        this.businessName = businessName;
    }


    //    public int getShoppPrice() {
//        return shoppPrice;
//    }
//
//    public void setShoppPrice(int shoppPrice) {
//        this.shoppPrice = shoppPrice;
//    }


    public String getMercBusinessId() {
        return mercBusinessId;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getIsCustomNum() {
        return isCustomNum;
    }

    public void setIsCustomNum(int isCustomNum) {
        this.isCustomNum = isCustomNum;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public int getSaleType() {
        return saleType;
    }

    public void setSaleType(int saleType) {
        this.saleType = saleType;
    }

    public String getBusinessId() {
        return businessId;
    }

    public void setBusinessId(String businessId) {
        this.businessId = businessId;
    }

    public int getDiscount() {
        return discount;
    }

    public int getSaleDiscount() {
        return saleDiscount;
    }

    public void setSaleDiscount(int saleDiscount) {
        this.saleDiscount = saleDiscount;
    }

    public void setDiscount(int discount) {
        this.discount = discount;
    }

    public int getCityId() {
        return cityId;
    }

    public void setCityId(int cityId) {
        this.cityId = cityId;
    }

    public int getStoreId() {
        return storeId;
    }

    public void setStoreId(int storeId) {
        this.storeId = storeId;
    }

    public int getSortNo() {
        return sortNo;
    }

    public void setSortNo(int sortNo) {
        this.sortNo = sortNo;
    }

    public int getUnit() {
        return unit;
    }

    public void setUnit(int unit) {
        this.unit = unit;
    }

    public String getFirstWord() {
        return firstWord;
    }

    public void setFirstWord(String firstWord) {
        this.firstWord = firstWord;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getImgPath() {
        return imgPath;
    }

    public void setImgPath(String imgPath) {
        this.imgPath = imgPath;
    }

    public String getName() {
        return CheckUtils.isEmptyString(name);
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTypeId() {
        return typeId;
    }

    public void setTypeId(String typeId) {
        this.typeId = typeId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUnitText() {
        return unitText;
    }

    public void setUnitText(String unitText) {
        this.unitText = unitText;
    }


    public List<ServiceListBean> getServiceList() {
        return serviceList;
    }

    public void setServiceList(List<ServiceListBean> serviceList) {
        this.serviceList = serviceList;
    }

    public static class ServiceListBean implements Parcelable {
        /**
         * code : 12
         * firstWord : QX
         * sortNo : 1
         * productId : 31
         * price : 1500
         * name : 清洗
         * id : 6
         * relId : 428
         * businessId : 1
         */

        private String code;
        private String firstWord;
        private int sortNo;
        private int productId;
        private int price;
        private String name;
        private String id;
        private int relId;
        private int businessId;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getFirstWord() {
            return firstWord;
        }

        public void setFirstWord(String firstWord) {
            this.firstWord = firstWord;
        }

        public int getSortNo() {
            return sortNo;
        }

        public void setSortNo(int sortNo) {
            this.sortNo = sortNo;
        }

        public int getProductId() {
            return productId;
        }

        public void setProductId(int productId) {
            this.productId = productId;
        }

        public int getPrice() {
            return price;
        }

        public void setPrice(int price) {
            this.price = price;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public int getRelId() {
            return relId;
        }

        public void setRelId(int relId) {
            this.relId = relId;
        }

        public int getBusinessId() {
            return businessId;
        }

        public void setBusinessId(int businessId) {
            this.businessId = businessId;
        }


        public ServiceListBean() {
        }


        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.code);
            dest.writeString(this.firstWord);
            dest.writeInt(this.sortNo);
            dest.writeInt(this.productId);
            dest.writeInt(this.price);
            dest.writeString(this.name);
            dest.writeString(this.id);
            dest.writeInt(this.relId);
            dest.writeInt(this.businessId);
        }

        protected ServiceListBean(Parcel in) {
            this.code = in.readString();
            this.firstWord = in.readString();
            this.sortNo = in.readInt();
            this.productId = in.readInt();
            this.price = in.readInt();
            this.name = in.readString();
            this.id = in.readString();
            this.relId = in.readInt();
            this.businessId = in.readInt();
        }

        public static final Creator<ServiceListBean> CREATOR = new Creator<ServiceListBean>() {
            @Override
            public ServiceListBean createFromParcel(Parcel source) {
                return new ServiceListBean(source);
            }

            @Override
            public ServiceListBean[] newArray(int size) {
                return new ServiceListBean[size];
            }
        };
    }


    @Override
    public boolean equals(Object arg0) {
        // TODO Auto-generated method stub
        ShoppingBean p = (ShoppingBean) arg0;
        return id.equals(p.id);
    }

    @Override
    public int hashCode() {
        // TODO Auto-generated method stub
        String str = id;
        return str.hashCode();
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.isCustomNum);
        dest.writeString(this.code);
        dest.writeInt(this.saleType);
        dest.writeTypedList(this.serviceList);
        dest.writeInt(this.discount);
        dest.writeInt(this.cityId);
        dest.writeInt(this.storeId);
        dest.writeInt(this.sortNo);
        dest.writeInt(this.unit);
        dest.writeString(this.firstWord);
        dest.writeInt(this.price);
        dest.writeInt(this.saleDiscount);
        dest.writeString(this.imgPath);
        dest.writeString(this.name);
        dest.writeString(this.typeId);
        dest.writeString(this.id);
        dest.writeString(this.unitText);
        dest.writeInt(this.count);
        dest.writeString(this.businessName);
        dest.writeString(this.businessId);
        dest.writeString(this.mercBusinessId);
        dest.writeString(this.selectServiceName);
        dest.writeString(this.selectServiceId);
        dest.writeString(this.proTypeId);
    }

    protected ShoppingBean(Parcel in) {
        this.isCustomNum = in.readInt();
        this.code = in.readString();
        this.saleType = in.readInt();
        this.serviceList = in.createTypedArrayList(ServiceListBean.CREATOR);
        this.discount = in.readInt();
        this.cityId = in.readInt();
        this.storeId = in.readInt();
        this.sortNo = in.readInt();
        this.unit = in.readInt();
        this.firstWord = in.readString();
        this.price = in.readInt();
        this.saleDiscount = in.readInt();
        this.imgPath = in.readString();
        this.name = in.readString();
        this.typeId = in.readString();
        this.id = in.readString();
        this.unitText = in.readString();
        this.count = in.readInt();
        this.businessName = in.readString();
        this.businessId = in.readString();
        this.mercBusinessId = in.readString();
        this.selectServiceName = in.readString();
        this.selectServiceId = in.readString();
        this.proTypeId = in.readString();
    }

    public static final Creator<ShoppingBean> CREATOR = new Creator<ShoppingBean>() {
        @Override
        public ShoppingBean createFromParcel(Parcel source) {
            return new ShoppingBean(source);
        }

        @Override
        public ShoppingBean[] newArray(int size) {
            return new ShoppingBean[size];
        }
    };
}
